package com.ruiya.staging.goods.core.constants;

public enum ErrorCodeEnum {
    OK("OK", "成功"),
    INTERNAL("INTERNAL.ERROR", "内部错误"),
    FAILED("FAILED", "失败"),
    PARAMSERROR("PARAMS.ERROR", "参数校验失败"),
    DATAIOERROR("DATAIO.ERROR", "请求data-io失败"),

    FailedGetGoodsId("FAILED.GETGOODSID", "调用Goods-Locate的GetGoodsId失败");

    private String code;
    private String msg;

    public boolean isOK(){
        return OK.getCode().equals(this.code);
    }

    public boolean isFail(){
        return !isOK();
    }

    ErrorCodeEnum(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public String getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    @Override
    public String toString() {
        return code + ":" + msg;
    }
}